<?php
namespace app\SuperAdmin\controller;
use think\Db;
use think\Controller;
use think\Session;
class EnrollController extends Controller
{
    public function _initialize()
    {
        if (!Session::has('adminid')) {
            $this->redirect('index/index/index');
        }
    }
    public function index()
        {

            $c=Db::table('enroll')
                ->alias(['enroll'=>'a','users'=>'b','activities'=>'c'])
                ->join('users','b.uid= a.uid')
                ->join('activities','c.aid= a.aid')
                ->order('eid asc')
                ->paginate(5);
            $this->assign('list', $c);
            return $this->fetch('enroll');

        }
    public function delete()
    {
        $eid = input('id');
        if (db("enroll")->delete($eid)) {
            $this->success("删除成功");
        } else {
            $this->error("删除失败");
        }

    }

}
